home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Risc World 3
/
Risc World 3.iso
/
SOFTWARE
/
ISSUE2
/
FASTERPC
/
DRIVE_C
/
GAMES
/
#IM
/
GRAPHICS
/
CGA
/
CGA.SRC
< prev
Wrap
Text File
|
1993-05-02
|
3KB
|
91 lines
; Test program for !FasterPC
; Copyright D.J.Lawrence, 1993
;
; This test program loads a CGA mode 06 screen and scrolls
; it vertically, as fast as it can. The program continues
; until the screen has scrolled once or until the user
; presses any key.
Code_Seg SEGMENT PUBLIC
ASSUME CS:Code_Seg
ORG 00100H ; Produce a '.COM' executable
MOV AX,0006H
INT 10H ; Mode 06H (CGA 2 colours)
; Load picture file into video memory
PUSH CS
POP DS
MOV AX,3D00H
MOV DX,OFFSET PicName
INT 21H ; Open picture file
MOV FHandle,AX
MOV BX,FHandle
MOV AX,0B800H
PUSH AX
POP DS
MOV AX,3F00H
MOV CX,04000H ; 16384 bytes to read
MOV DX,0000H
INT 21H ; Read picture file into video memory
MOV BX,FHandle
MOV AX,3E00H
INT 21H ; Close picture file
; Perform the screen scroll for 200 pixels
; or until the user presses a key
; Initialise the 200 counter
MOV BX,00C8H
; First store the first half of screen memory
UScroll: MOV AX,0B800H
PUSH CS
PUSH AX
POP DS ; DS = B800
POP ES ; ES = CS
MOV SI,0000H
MOV DI,OFFSET DataArea
MOV CX,0FA0H ; Copy half screen (100 rows * 80 bytes = 4000 words)
REP MOVSW
; Next, copy the second half of the screen to the first half
PUSH DS
POP ES ; ES = B800
MOV SI,2000H
MOV DI,0000H
MOV CX,0FA0H
REP MOVSW
; Next, copy the first half back to the second shifted up by one row
PUSH CS
POP DS ; DS = CS
MOV SI,OFFSET DataArea
ADD SI,0050H
MOV DI,2000H
MOV CX,0F78H ; 99 rows * 80 bytes = 3960 words
REP MOVSW
; Finally, copy the first row to the last row
MOV SI,OFFSET DataArea
MOV CX,0028H ; 1 row * 80 bytes = 40 words
REP MOVSW
; See if the 200 rows have been completed
DEC BX
CMP BX,0000H
JE Quit2
; See if user wants to exit
MOV AX,0100H
INT 16H ; Has a key has been pressed ?
JNE Quit1 ; Yes - jump
JMP UScroll ; No - continue scroll
Quit1: MOV AX,0000H
INT 16H ; Read the detected key
Quit2: MOV AX,0003H
INT 10H ; CGA mode 3 (80x25 colour text)
RET
FHandle DW ?
PicName DB 'CGA.PIC',0
DataArea DB 8192 DUP ?
Code_Seg ENDS